package crypto.aes.cbc.PKCS7Padding;

import java.security.Provider;
import java.security.Security;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.bouncycastle.util.encoders.Hex;

public class Test {

  public static void main(String[] args) {

    for (Provider p : Security.getProviders()) {
      System.out.println(p.getName() + "==" + p.getInfo());
    }
    AES aes = new AES();
//   加解密 密钥
    byte[] keybytes = {0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38};
    String content = "1";
    // 加密字符串
    System.out.println("加密前的：" + content);
    System.out.println("加密密钥：" + new String(keybytes));
    // 加密方法
    byte[] enc = aes.encrypt(content.getBytes(), keybytes);
    System.out.println("加密后的内容：" + new String(Hex.encode(enc)));
    // 解密方法
    byte[] dec = aes.decrypt(enc, keybytes);
    System.out.println("解密后的内容：" + new String(dec));

    String[] DIGESTS = new String[]{"GOST3411", "Keccak", "MD2", "MD4", "MD5", "SHA1", "RIPEMD128", "RIPEMD160", "RIPEMD256", "RIPEMD320",
        "SHA224", "SHA256", "SHA384", "SHA512", "SHA3", "Skein", "SM3", "Tiger", "Whirlpool", "Blake2b", "Blake2s", "DSTU7564"};

    List<String> sortList = Arrays.asList(DIGESTS);
    Collections.sort(sortList);
    sortList.forEach(System.out::println);
  }
}
